package com.innovate.cms.modules.qs.entity.order;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import com.github.wxpay.sdk.WXPayConfig;

public class WXMyConfigUtil implements WXPayConfig {
	private byte[] certData;

	public WXMyConfigUtil() throws Exception {
		// String certPath = "证书地址";// 从微信商户平台下载的安全证书存放的目录
		//
		// File file = new File(certPath);
		// InputStream certStream = new FileInputStream(file);
		// this.certData = new byte[(int) file.length()];
		// certStream.read(this.certData);
		// certStream.close();

		this.certData = WxPayConfig.partnerkey.getBytes();
	}

	@Override
	public String getAppID() {
		return WxPayConfig.AppID;
	}

	// parnerid
	@Override
	public String getMchID() {
		return WxPayConfig.partner;
	}

	@Override
	public String getKey() {
		return WxPayConfig.partnerkey;
	}

	@Override
	public InputStream getCertStream() {
		ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
		return certBis;
	}

	@Override
	public int getHttpConnectTimeoutMs() {
		return 8000;
	}

	@Override
	public int getHttpReadTimeoutMs() {
		return 10000;
	}
}
